package com.delta.rafg.core.utils;

import java.util.Map;
import java.util.TreeMap;

public final class CarrierCodeUtils {

	private Map<String, String> partnerCarrierCodes = new TreeMap<String, String>();

	private CarrierCodeUtils() {
	}

	/**
	 * @return the partnerCarrierCodes
	 */
	public Map<String, String> getPartnerCarrierCodes() {
		return partnerCarrierCodes;
	}

	/**
	 * @param partnerCarrierCodes
	 *            the partnerCarrierCodes to set
	 */
	public void setPartnerCarrierCodes(Map<String, String> partnerCarrierCodes) {
		this.partnerCarrierCodes = partnerCarrierCodes;
	}

	// Author: 320800 - Start
	/**
	 * Changing lazy initializations to eager non-blocking initializations
	 */
	private static CarrierCodeUtils instance = new CarrierCodeUtils();

	public static CarrierCodeUtils getCarrierCodeUtils() {
		return instance;
	}

	// Author: 320800 - End

	public String getPartnerEquivalentCode(final String carrierCode) {

		if (carrierCode == null)
			return null;
		final String value = this.partnerCarrierCodes.get(carrierCode);
		if (value == null || value.trim().isEmpty()) {

			return null;
		}

		return value;
	}
}
